package com.jinmdz.fmis.mapper.mapper;

import com.jinmdz.fmis.mapper.entity.RecPorterEntity;
import com.jinmdz.fmis.mapper.mapper.provider.RecPorterProvider;
import org.apache.ibatis.annotations.*;

import java.util.ArrayList;

/**
 * 接运抬尸工表Mapper
 *
 * @author generator
 * @date 2020-06-16 10:19
 */
public interface RecPorterMapper {

    /**
     * 增加RecPorter
     *
     * @param entity 数据实体
     * @return
     * @author generator
     * @date 2020-06-16 10:19
     */
    @InsertProvider(type = RecPorterProvider.class, method = "insertRecPorter")
    @Options(useGeneratedKeys = true, keyProperty = "entity.id", keyColumn = "id")
    void insertRecPorter(@Param("entity") RecPorterEntity entity);

    /**
     * 删除RecPorter
     *
     * @param id             主键
     * @param modifiedUserId 修改用户外键
     * @param version        版本号
     * @return
     * @author generator
     * @date 2020-06-16 10:19
     */
    @Update(" update rec_porter set deleted = 1,modified_user_id = #{modifiedUserId},version = unix_timestamp(now()) where id = #{id} and version = #{version} and unmodified = 0 and deleted = 0 ")
    void deletedForRecPorter(@Param("id") Integer id, @Param("modifiedUserId") Integer modifiedUserId, @Param("version") Long version);

    /**
     * 修改RecPorter
     *
     * @param entity 数据实体
     * @return
     * @author generator
     * @date 2020-06-16 10:19
     */
    @UpdateProvider(type = RecPorterProvider.class, method = "updateRecPorter")
    void updateRecPorter(@Param("entity") RecPorterEntity entity);

    /**
     * 查询RecPorter实体
     *
     * @param id 主键
     * @return RecPorterEntity
     * @author generator
     * @date 2020-06-16 10:19
     */
    @Select(" select id,deleted,rec_id,system_user_id,funeral_parlour_code,create_user_id,gmt_create,unmodified,modified_user_id,gmt_modified,version from rec_porter where id = #{id} and deleted = 0 limit 1 ")
    RecPorterEntity getRecPorterById(@Param("id") Integer id);

    /**
     * 查询RecPorter列表
     *
     * @param entity 数据实体
     * @return RecPorterEntity
     * @author generator
     * @date 2020-06-16 10:19
     */
    @SelectProvider(type = RecPorterProvider.class, method = "listRecPorter")
    ArrayList<RecPorterEntity> listRecPorter(@Param("entity") RecPorterEntity entity);
}